package cn.tedu.submarine_2;
import javax.swing.ImageIcon;

/**
 * 战舰类
 */
public class Battleship extends SeaObject{

    private int life;
    public Battleship() {
        super(66,26,270,124,20);
        life=5;
    }

    @Override
    public void move() {

    }

    @Override
    public ImageIcon getImage() {
        return Images.battleship;
    }

    /**
     * 发射炸弹
     * @return 返回炸弹对象
     */
    public Bomb shootBomb(){
        return new Bomb(this.x,this.y);
    }

    /**
     * 战舰左移
     */
    public void moveLeft(){
        x-=speed;
    }
    /**
     * 战舰you移
     */
    public void moveRight(){
        x+=speed;
    }

    /**
     * 战舰增命
     * @param num
     */
    public void addLife(int num){
        life+=num;
    }

    /**
     * 获取战舰命数
     * @return
     */
    public int getLife(){
        return life;
    }

    /**
     * 战舰减命
     */
    public void subtractLife(){
        life--;
    }
}
